args S o1 o2 ControlsC ControlsC_notee ControlsI ControlsNCog ControlsGA

local MDV 1
local dp 3

* Panel 1
spec `S' "`ControlsC'" "`ControlsC_notee'" "`ControlsI'" "`ControlsNCog'"  "`ControlsGA'"
local opt start
local text "prehead(\vspace{.05cm}  \\ \multicolumn{8}{l}{\textbf{Panel A: Above average ability}} \\ \multicolumn{8}{l}{\phantom{.}} \\ \vspace{-.6cm}  \\ ) "

do StataSubCode/OutcomeOLSkills.do "`r(Ct)'"  "`o1'" "AbSelfRating_`r(name)'" "`r(keepvars)'" "`opt'" "`text'" "`r(ipw)'" "`r(CreativityMeasure)'" "`MDV'" "`dp'" ///
	"Math" "English" "Science" "Art" "Music" "Practical" "Sports"

* Panel 2
spec `S' "`ControlsC'" "`ControlsC_notee'" "`ControlsI'" "`ControlsNCog'"  "`ControlsGA'"
local opt appendL

local text "prehead( \vspace{.2cm}  \\ \multicolumn{8}{l}{\textbf{Panel B: Average or above average ability}} \\ \multicolumn{8}{l}{\phantom{.}} \\ \vspace{-.6cm}  \\ ) "

do StataSubCode/OutcomeOLSkills.do "`r(Ct)'"  "`o2'" "AbSelfRating_`r(name)'" "`r(keepvars)'" "`opt'" "`text'" "`r(ipw)'" "`r(CreativityMeasure)'" "`MDV'" "`dp'" ///
	"Math" "English" "Science" "Art" "Music" "Practical" "Sports"


if `S'==1 | `S'==6 {

	local dp 4

	* Panel 1
	spec `S' "`ControlsC'" "`ControlsC_notee'" "`ControlsI'" "`ControlsNCog'" "`ControlsGA'"
	local opt start
	local text "prehead(\vspace{.05cm}  \\ \multicolumn{8}{l}{\textbf{Panel A: Above average ability}} \\ \multicolumn{8}{l}{\phantom{.}} \\ \vspace{-.6cm}  \\ ) "

	do StataSubCode/OutcomeOLSkills.do "`r(Ct)'"  "`o1'" "AbSelfRating4dp_`r(name)'" "`r(keepvars)'" "`opt'" "`text'" "`r(ipw)'" "`r(CreativityMeasure)'" "`MDV'" "`dp'" ///
		"Math" "English" "Science" "Art" "Music" "Practical" "Sports"

	* Panel 2
	spec `S' "`ControlsC'" "`ControlsC_notee'" "`ControlsI'" "`ControlsNCog'" "`ControlsGA'"
	local opt appendL

	local text "prehead( \vspace{.2cm}  \\ \multicolumn{8}{l}{\textbf{Panel B: Average or above average ability}} \\ \multicolumn{8}{l}{\phantom{.}} \\ \vspace{-.6cm}  \\ ) "

	do StataSubCode/OutcomeOLSkills.do "`r(Ct)'"  "`o2'" "AbSelfRating4dp_`r(name)'" "`r(keepvars)'" "`opt'" "`text'" "`r(ipw)'" "`r(CreativityMeasure)'" "`MDV'" "`dp'" ///
		"Math" "English" "Science" "Art" "Music" "Practical" "Sports"


}


